Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster: fail when no private address can be found #1437

Merged
merged 2 commits into from
Jul 5, 2018

Conversation

simonpasquier
Copy link
Member

Relates to #1434.

The memberlist library fails when it can't find a private address and no
advertise address is given. To return a helpful message to the user,
AlertManager mimics the logic from memberlist. However the code had a
bug that swallowed the error message and made it difficult for the user
to understand how to fix the problem.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
if err != nil {
return nil, errors.Wrap(err, "failed to get private IP")
}
if privateIP == "" {
return nil, errors.Wrap(err, "no private IP found, explicit advertise addr not provided")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err being nil, errors.Wrap(err, ...) was also nil.

if err != nil {
return nil, errors.Wrap(err, "failed to get private IP")
}
if privateIP == "" {
return nil, errors.Wrap(err, "no private IP found, explicit advertise addr not provided")
return nil, errors.Errorf("no private IP found, explicit advertise addr not provided")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use errors.New here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason. I'll update.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. In case there are no final thoughts by @stuartnelson3 I will merge tomorrow.

@mxinden mxinden merged commit f5a258d into prometheus:master Jul 5, 2018
@simonpasquier simonpasquier deleted the fix-missing-err branch July 6, 2018 14:55
mxinden pushed a commit to mxinden/alertmanager that referenced this pull request Jul 10, 2018
The memberlist library fails when it can't find a private address and no
advertise address is given. To return a helpful message to the user,
AlertManager mimics the logic from memberlist. However the code had a
bug that swallowed the error message and made it difficult for the user
to understand how to fix the problem.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
@mxinden mxinden mentioned this pull request Jul 10, 2018
eqyiel added a commit to eqyiel/nixpkgs that referenced this pull request Aug 17, 2018
Alertmanager fails to start when the memberlist library cannot find any private
IP addresses on the system.  This is a safeguard to avoid exposing cluster ports
over the internet unintentionally.  The workaround is to pass the
--cluster.advertise-address argument to AlertManager.

See also:
prometheus/alertmanager#1437
prometheus/alertmanager#1434
eqyiel added a commit to eqyiel/nixpkgs that referenced this pull request Aug 18, 2018
Alertmanager fails to start when the memberlist library cannot find any private
IP addresses on the system.  This is a safeguard to avoid exposing cluster ports
over the internet unintentionally.  The workaround is to pass the
--cluster.advertise-address argument to AlertManager.

See also:
prometheus/alertmanager#1437
prometheus/alertmanager#1434
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants